home *** CD-ROM | disk | FTP | other *** search
- function loadImage(mc, node, extrapath)
- {
- var _loc3_ = extrapath;
- if(_loc3_ == null)
- {
- _loc3_ = "";
- }
- var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
- var _loc1_ = node.firstChild.nodeValue;
- var _loc2_ = node.attributes.path;
- if(_loc2_ != null)
- {
- _loc1_ = _loc2_ + _loc1_;
- }
- else
- {
- _loc1_ = strDefaultPath + _loc3_ + _loc1_;
- }
- if(strPathPrefix == null)
- {
- strPathPrefix = "";
- }
- mc.loadMovie(strPathPrefix + _loc1_);
- }
- function addLink(mc)
- {
- Links[mc.link] = mc;
- }
- function getMCfromLink(Item)
- {
- var _loc1_ = Item;
- if(Links[_loc1_] == null)
- {
- var _loc2_ = [];
- while(_loc1_ != sideMenu.ItemHome)
- {
- _loc2_.unshift(_loc1_._name.split("_").pop());
- _loc1_ = _loc1_._parent._parent;
- }
- var _loc3_ = _loc2_.join("/");
- Links[_loc1_] = Links[_loc3_];
- }
- return Links[_loc1_];
- }
- function removeLinkListener()
- {
- Tardis.sideMenu.EB.removeListener(this);
- }
- function init()
- {
- build();
- }
- function build()
- {
- var strID = Tardis.ActiveSection.id;
- var _loc2_ = Tardis.Colors;
- strSECTION_COLOR = _loc2_.getString(strID);
- SECTION_COLOR = _loc2_.getHex(strID);
- strSECTION_COLOR50 = _loc2_.getString(strID + "50");
- SECTION_COLOR50 = _loc2_.getHex(strID + "50");
- DEFAULT_COLOR = _loc2_.getHex("default");
- DEFAULT_COLOR50 = _loc2_.getString("default50");
- modWidth = nodeData.byName("dimensions").attributes.width;
- txtWidth = modWidth - 12;
- modHeight = nodeData.byName("dimensions").attributes.height;
- loadImage(mc_img_0,nodeData.byName("image"),IMAGE_PATH);
- titlevar = false;
- if(nodeData.byName("title").getText() != null || nodeData.byName("title2").getText() != null || nodeData.byName("title3").getText() != null)
- {
- var strTitle = "<FONT COLOR=\"" + strSECTION_COLOR + "\">" + nodeData.byName("title").getText() + " </FONT>";
- strTitle += "<FONT COLOR=\"" + strSECTION_COLOR50 + "\"> " + nodeData.byName("title2").getText() + " </FONT>";
- strTitle += "<FONT COLOR=\"" + DEFAULT_COLOR50 + "\"> " + nodeData.byName("title3").getText() + " </FONT>";
- titleFF.htmlText = strTitle;
- titleFF.resize();
- titleVar = true;
- }
- title2var = false;
- var strByline = nodeData.byName("byline").getText();
- if(strByline != null)
- {
- title2FF.htmlText = strByline;
- title2FF.textColor = DEFAULT_COLOR;
- title2FF.resize();
- title2var = true;
- }
- this.attachMovie("scrollContentMC","sMC",++depth);
- sMC._visible = false;
- sMC.bodyFF._width = sMC.body2FF._width = txtWidth;
- var ndBody = nodeData.byName("body");
- if(ndBody.getText() != null)
- {
- sMC.bodyFF.htmlText = parseBoldTags(ndBody.getText());
- sMC.bodyFF.textColor = DEFAULT_COLOR;
- sMC.bodyFF.autoSize = true;
- sMC.bodyFF._y = CONTENT_POS;
- CONTENT_POS += sMC.bodyFF._height + 12;
- }
- var ndBody2 = nodeData.byName("body2");
- if(ndBody2.getText() != null)
- {
- sMC.body2FF.htmlText = parseBoldTags(ndBody2.getText());
- sMC.body2FF.textColor = DEFAULT_COLOR;
- sMC.body2FF.autoSize = true;
- sMC.body2FF._y = CONTENT_POS;
- CONTENT_POS += sMC.body2FF._height;
- }
- var _loc1_ = bodyLinkMC;
- var _loc3_ = nodeData.byName("bodylink");
- var strLabel1 = _loc3_.byName("label1").getText();
- var strLabel2 = _loc3_.byName("label2").getText();
- if(strLabel1 != null || strLabel2 != null)
- {
- _loc1_.contentFF.htmlText = strLabel1;
- _loc1_.contentFF.textColor = SECTION_COLOR;
- _loc1_.content2FF.htmlText = strLabel2;
- _loc1_.content2FF.textColor = SECTION_COLOR;
- _loc1_.link = _loc3_.attributes.link;
- if(_loc3_.attributes.promo != null)
- {
- _loc1_.promolink = _loc3_.byName("link").getText();
- }
- else
- {
- _loc1_.promolink = 0;
- }
- _loc1_.contentFF.autoSize = true;
- _loc1_.content2FF.autoSize = true;
- _loc1_.btn._width = _loc1_.contentFF._width + _loc1_.arrowMC._x - 20;
- _loc1_.arrowMC._x = _loc1_.contentFF._x + _loc1_.contentFF._width + 1;
- }
- else
- {
- _loc1_._height = 0;
- _loc1_._visible = false;
- _loc1_.arrowMC._visible = false;
- }
- intervalID = setInterval(checkLoad,100);
- onComplete();
- }
- function checkLoad()
- {
- if(mc_img_0._height > 0)
- {
- TEXT_POS = mc_img_0._x + mc_img_0._height - 4;
- if(titlevar)
- {
- titleFF._y = TEXT_POS;
- TEXT_POS += titleFF._height - 7;
- }
- if(title2var)
- {
- title2FF._y = TEXT_POS;
- TEXT_POS += title2FF._height - 9;
- }
- var _loc1_ = nodeData.byName("bodylink").byName("label1").getText();
- var strLabel12 = nodeData.byName("bodylink").byName("label2").getText();
- if(_loc1_ != null || strLabel2 != null)
- {
- heightToTest = modHeight - TEXT_POS - bodyLinkMC.contentFF._height - bodyLinkMC.content2FF._height - 10;
- }
- else
- {
- heightToTest = modHeight - TEXT_POS - 12;
- }
- if(sMC._height > heightToTest)
- {
- attachMovie("FScrollPaneSymbol","contentScroll",++depth);
- attachMovie("MaskerMC","MaskerMC",++depth);
- contentScroll._x = 7;
- contentScroll._y = TEXT_POS;
- if(_loc1_ != null)
- {
- contentScroll.setSize(modWidth,modHeight - TEXT_POS - bodyLinkMC.contentFF._height - bodyLinkMC.content2FF._height - 10);
- }
- else
- {
- contentScroll.setSize(modWidth,modHeight - TEXT_POS - 12);
- }
- contentScroll.setHScroll(false);
- contentScroll.setScrollContent(sMC);
- MaskerMC._x = 6;
- MaskerMC._y = TEXT_POS - MaskerMC._height + 10;
- MaskerMC._width = contentScroll._width - 17;
- MaskerMC._height = 5;
- }
- else
- {
- sMC._x = 8;
- sMC._y = TEXT_POS;
- if(sMC.txtbodyLink._y < modHeight - sMC.txtbodyLink.height - 38)
- {
- sMC.txtbodyLink._y = modHeight - sMC.txtbodyLink.height - 38;
- }
- }
- _visible = true;
- sMC._visible = true;
- clearInterval(intervalID);
- }
- }
- function txtOver(mc)
- {
- var _loc1_ = mc;
- if(_loc1_.promolink == 0)
- {
- Tardis.sideMenu.doOver(_loc1_.link);
- }
- bodyLinkMC.contentFF.textColor = SECTION_COLOR;
- bodyLinkMC.arrowMC.gotoAndStop("over");
- }
- function parseBoldTags(str)
- {
- var _loc1_ = str;
- var _loc2_ = _loc1_.indexOf("<b>");
- if(_loc2_ != -1)
- {
- var _loc3_ = _loc1_.indexOf("</b>");
- var word = _loc1_.substring(_loc2_ + 3,_loc3_);
- var beginning = _loc1_.substring(0,_loc2_);
- var end = _loc1_.substring(_loc3_ + 4);
- return beginning + "<font face=\'FranklinGotURWTDem\'>" + word + "</font>" + parseBoldTags(end);
- }
- return _loc1_;
- }
- function txtOut(mc)
- {
- var _loc1_ = mc;
- if(_loc1_.promolink == 0)
- {
- Tardis.sideMenu.doOut(_loc1_.link);
- }
- bodyLinkMC.contentFF.textColor = SECTION_COLOR50;
- bodyLinkMC.arrowMC.gotoAndStop("off");
- }
- function txtUp(mc)
- {
- var _loc1_ = mc;
- if(_loc1_.promolink != 0)
- {
- Tardis.webPageOpen(_loc1_.promolink);
- }
- else
- {
- Tardis.sideMenu.doUp(_loc1_.link);
- }
- }
- function doOver(num)
- {
- if(bodyLinkMC.link == num)
- {
- bodyLinkMC.contentFF.textColor = SECTION_COLOR;
- bodyLinkMC.arrowMC.gotoAndStop("over");
- }
- }
- function doOut(num)
- {
- if(bodyLinkMC.link == num)
- {
- bodyLinkMC.contentFF.textColor = SECTION_COLOR50;
- bodyLinkMC.arrowMC.gotoAndStop("off");
- }
- }
- function searchandreplace(the_string, search_string, replace_string, occurrences, backward)
- {
- var _loc1_ = the_string;
- var _loc3_ = search_string;
- if(_loc3_ == replace_string)
- {
- return _loc1_;
- }
- var found = 0;
- if(backward == true)
- {
- var _loc2_ = _loc1_.lastIndexOf(_loc3_);
- while(_loc2_ >= 0)
- {
- found++;
- var start_string = _loc1_.substr(0,_loc2_);
- var end_string = _loc1_.substr(_loc2_ + _loc3_.length);
- _loc1_ = start_string + replace_string + end_string;
- _loc2_ = _loc1_.lastIndexOf(_loc3_,start_string.length);
- if(found == occurrences)
- {
- _loc2_ = -1;
- }
- }
- }
- else
- {
- _loc2_ = _loc1_.indexOf(_loc3_);
- while(_loc2_ >= 0)
- {
- found++;
- var start_string = _loc1_.substr(0,_loc2_);
- var end_string = _loc1_.substr(_loc2_ + _loc3_.length);
- _loc1_ = start_string + replace_string + end_string;
- _loc2_ = _loc1_.indexOf(_loc3_,_loc2_ + replace_string.length);
- if(found == occurrences)
- {
- _loc2_ = -1;
- }
- }
- }
- return _loc1_;
- }
- function tagStack(aString)
- {
- var error = false;
- var tagArray = [];
- var validTags = ["a","b","i","u","font","p"];
- var tStringArray = aString.split("<");
- var _loc3_ = 1;
- while(_loc3_ < tStringArray.length)
- {
- var _loc1_ = "<" + tStringArray[_loc3_].slice(0,tStringArray[_loc3_].indexOf(">") + 1);
- var shortForm = _loc1_.indexOf(" ") <= -1 ? _loc1_ : _loc1_.slice(0,_loc1_.indexOf(" ")) + ">";
- var tagOnly = shortForm.indexOf("/") <= -1 ? shortForm.slice(1,-1) : shortForm.slice(2,-1);
- isValidTag = false;
- for(var j in validTags)
- {
- if(validTags[j] == tagOnly)
- {
- isValidTag = true;
- break;
- }
- }
- if(isValidTag)
- {
- if(_loc1_.charAt(1) == "/")
- {
- var _loc2_ = tagArray.pop();
- lastTagShort = _loc2_.indexOf(" ") <= -1 ? _loc2_ : _loc2_.slice(0,_loc2_.indexOf(" ")) + ">";
- lastTagShort = lastTagShort.indexOf("/") <= -1 ? lastTagShort.slice(1,-1) : lastTagShort.slice(2,-1);
- if(lastTagShort != tagOnly)
- {
- error = true;
- break;
- }
- }
- else
- {
- tagArray.push(_loc1_);
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- if(!error)
- {
- return tagArray;
- }
- return -1;
- }
- function fixText(textString)
- {
- var _loc3_ = textString;
- var _loc1_ = searchandreplace(_loc3_,String.fromCharCode(13)," <br>");
- _loc1_ = searchandreplace(_loc3_,"\n"," <br>");
- _loc1_ = searchandreplace(_loc3_,"\r"," <br>");
- _loc1_ = searchandreplace(_loc1_,String.fromCharCode(9)," ");
- var _loc2_ = _loc1_.split(" ");
- return _loc2_;
- }
- function flowText(textString, arrayOfTextFields)
- {
- var textArray = fixText(textString);
- var currentWordIndex = 0;
- var currentFieldIndex = 0;
- var maxWordIndex = textArray.length;
- var timeArray = [];
- var leftOverTags = "";
- var i;
- var lastWord = 0;
- for(i in arrayOfTextFields)
- {
- eval(arrayOfTextFields[i]).html = false;
- eval(arrayOfTextFields[i]).text = "";
- eval(arrayOfTextFields[i]).htmlText = "";
- }
- do
- {
- if(currentWordIndex < maxWordIndex)
- {
- var field = eval(arrayOfTextFields[currentFieldIndex]);
- var tempString = "";
- field.html = true;
- if(textArray[currentWordIndex].indexOf("<br>") != -1)
- {
- textArray[currentWordIndex] = searchandreplace(textArray[currentWordIndex],"<br>","");
- }
- i = currentWordIndex;
- while(i < maxWordIndex)
- {
- var newWord = textArray[i];
- newWord = newWord != "<br>" ? newWord + " " : newWord;
- tempString += newWord;
- field.htmlText = "";
- field.htmlText = tempString;
- if(field.maxscroll > 1)
- {
- lastWord = i;
- break;
- }
- i++;
- }
- }
- else
- {
- return true;
- }
- field.htmlText = "";
- var endAt = i;
- field.htmlText = leftOverTags + textArray.slice(currentWordIndex,endAt).join(" ");
- leftOverTags = tagStack(textArray.slice(0,endAt).join(" ")).join("");
- currentWordIndex = endAt;
- currentFieldIndex++;
- }
- while(currentFieldIndex <= arrayOfTextFields.length);
-
- var leftOverText = textArray.slice(lastWord,textArray.length).join(" ");
- return leftOverText;
- }
- _visible = false;
- Links = {};
- Tardis.sideMenu.EB.addListener(this);
- SCROLLBOX_INIT_POS = 55;
- TEXT_POS = 30;
- CONTENT_POS = 0;
- onReady();
- this.onUnload = function()
- {
- clearInterval(intervalID);
- removeLinkListener();
- };
- stop();
-